<%@ Page Language="C#" ValidateRequest="false" AutoEventWireup="true" MasterPageFile="~/Admin/AdminMasterPage.master" CodeFile="EditProductDetail.aspx.cs" Inherits="Admin_EditProductDetail" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="FreeTextBox" Namespace="FreeTextBoxControls" TagPrefix="FTB" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderAdmin" Runat="Server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
    
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" DataSourceID="ObjectDataSource1" GridLines="None">
            <MasterTableView AutoGenerateColumns="False" CellSpacing="-1" DataSourceID="ObjectDataSource1">
                <RowIndicatorColumn>
                    <HeaderStyle Width="20px" />
                </RowIndicatorColumn>
                <ExpandCollapseColumn>
                    <HeaderStyle Width="20px" />
                </ExpandCollapseColumn>
                <Columns>
                <telerik:GridTemplateColumn>
                    <HeaderTemplate>
                        <asp:LinkButton Font-Underline="true" ID="btnInsert" CommandName="InitInsert" runat="server">New Product</asp:LinkButton>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:LinkButton ID="btnEdit" runat="server" CommandName="Edit" Font-Underline="true">Edit</asp:LinkButton>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>                
                    <telerik:GridBoundColumn DataField="ProductID" DataType="System.Int32" HeaderText="ProductID"
                        SortExpression="ProductID" UniqueName="ProductID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CategoryID" DataType="System.Int32" HeaderText="CategoryID"
                        SortExpression="CategoryID" UniqueName="CategoryID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName"
                        UniqueName="ProductName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="UnitPrice" DataType="System.Decimal" HeaderText="UnitPrice"
                        SortExpression="UnitPrice" UniqueName="UnitPrice">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="UnitsInStock" DataType="System.Int32" HeaderText="UnitsInStock"
                        SortExpression="UnitsInStock" UniqueName="UnitsInStock">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="UnitsOnOrder" DataType="System.Int32" HeaderText="UnitsOnOrder"
                        SortExpression="UnitsOnOrder" UniqueName="UnitsOnOrder">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Picture" HeaderText="Picture" SortExpression="Picture" Visible="false"
                        UniqueName="Picture">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Rating" DataType="System.Single" HeaderText="Rating"
                        SortExpression="Rating" UniqueName="Rating">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn>
                        <ItemTemplate>
                            <asp:LinkButton ID="btnDelete" runat="server" CommandName="Delte" Font-Underline="true">Delete</asp:LinkButton>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
                
                <EditFormSettings EditFormType="Template">
                <EditColumn UniqueName="EditCommandColumn1" ButtonType="PushButton" CancelText="iCancel" UpdateText="iUpdate"></EditColumn>
                <FormTemplate>
                        <table cellpadding="10px">
                            <tr>
                                <td>
                                
                                </td>
                                <td>
                                    ProductID : <telerik:RadTextBox ID="FreeTextBoxID" runat="server" Text='<%# Bind("ProductID") %>' ReadOnly="true" />
                                </td>
                                <td>
                                    CategoryID : <telerik:RadTextBox ID="RadTextBox0" runat="server" Text='<%# Bind("CategoryID") %>' />                                    
                                </td>
                            </tr>
                            <tr>
                                <td>
                                
                                </td>                            
                                <td>
                                    ProductName : <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ProductName") %>' />
                                </td>
                                <td>
                                
                                </td>
                            </tr>
                            <tr>
                                <td>
                                
                                </td>                            
                                <td>
                                    UnitPrice : <telerik:RadTextBox ID="RadTextBox3" runat="server" Text='<%# Bind("UnitPrice") %>' />
                                </td>
                                <td>
                                    UnitsInStock : <telerik:RadTextBox ID="RadTextBox4" runat="server" Text='<%# Bind("UnitsInStock") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Features : 
                                </td>
                                <td colspan="2">
                                    <FTB:FreeTextBox ID="FreeTextBox1" runat="server" Text='<%# Bind("Features") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    DescriptionBrief : 
                                </td>
                                <td colspan="2">
                                    <FTB:FreeTextBox ID="FreeTextBox2" runat="server" Text='<%# Bind("DescriptionBrief") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Description : 
                                </td>
                                <td colspan="2">
                                    <FTB:FreeTextBox ID="FreeTextBox3" runat="server" Text='<%# Bind("Description") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Picture : 
                                </td>
                                <td colspan="2">
                                    <asp:Image ID="previewImage" runat="server" ImageUrl='<%# Bind("Picture") %>' />
                                </td>
                            </tr>                                                                                                                                                                                                                                                            
                            <tr>
                                <td colspan="2" align="center">
                                    <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                    </asp:Button>
                                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
                                </td>
                            </tr>                    
                </FormTemplate>
                </EditFormSettings>                
            </MasterTableView>
        </telerik:RadGrid>
    
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Entities.ProductInfo" DeleteMethod="Delete" InsertMethod="Insert" SelectMethod="GetByID" TypeName="Bll.ProductBll" UpdateMethod="Update">
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="1" Name="productID" QueryStringField="id"
                    Type="String" />
            </SelectParameters>
        </asp:ObjectDataSource>
</asp:Content>
